﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace NinjaToolbox.PhysicsSystem
{
    public class RaycastTestBVH : MonoBehaviour
    {
        public float distance;
        public int bvhID;


        void Update()
        {
            var isHit = PhysicsUtil.Raycast_Bvh(new Ray(transform.position, transform.forward), distance, out Vector3 intersectPoint, bvhID);
            Debug.DrawRay(transform.position, transform.forward, isHit ? Color.red : Color.white);
            if (isHit)
            {
                Debug.Log("intersectPoint: " + intersectPoint);
                Debug.DrawRay(intersectPoint, Vector3.forward * 0.2f);
            }
        }
    }
}
